<template>
  <div class="hot-page">
    <headBar  isBack="show">
      <div slot="xm-header-center">
        <div class="xm-header-title" >新品馆</div>
      </div>
      <div slot="xm-header-right"></div>
    </headBar>
    <!--广告1-->
    <div class="ad" @click="goodsList(10277,null)">
      <img src="./img/tj-1.jpg">
    </div>
    <!--肉制品-->
    <div class="hot-group">
      <div class="flex flex-pack-justify tit bg-3">
        <span>新上线特产品</span>
        <a class="more" @click="more" >更多</a>
      </div>
      <dl class="flex flex-pack-justify flex-wrap">
        <dd class="goods-item border-1px" v-for="item in wareList" @click="detail(item.id)">
          <img :src="item.imageThumb">
          <h3>{{item.name || '商品名未知'}}</h3>
          <p class="price color-1"><price :priceUnit="item.priceUnit" unitName=""></price>/{{item.unitName}}</p>
          <p class="store flex flex-pack-justify">
            <span>库存:{{item.numberInventory || 0}}件</span><span>销量：{{item.wareCount||0}}件</span>
          </p>
        </dd>
      </dl>
  </div>
  </div>
</template>
<script>
    export default {
        props: {},
        data() {
            return {
              wareList: [],
              tagId: '',
              isLogin: !!Cookie.get('name')
            };
        },
        methods: {
            // 获取商品列表
          getNewGoodsList(){
            newGoods({siteId: Cookie.get('siteId')}).then(data=>{
              if(data.returnCode == '000000'){
                this.wareList = data.result.wareList;
                this.tagId = data.result.tagId;
              }
            })
          },
          goodsList: function(brandId, cateId){
            this.$router.push({name: 'goodsListCate', params: {brandId: brandId, cateId: cateId}});
          },
          /**
           * 商品详情
           * @param <string> 商品Id
           * */
          detail(goodsId){
            this.$router.push({name: 'goodsDetail', params: {wareId: goodsId}});
          },
          //获取更多
          more(){
            this.$router.push({name: 'goodsListNew', params: {tagId: this.tagId, labelName: '新品'}});
          }
        },
        filters: {},
        created() {
            this.getNewGoodsList();
        },
        mounted(){

        },
        components: {
        }
    };
</script>
<style lang="less">
  @import "./hot.less";
</style>
